package bma.common.langutil.xdom.core;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import bma.common.langutil.xdom.Xdom;
import bma.common.langutil.xdom.XdomType;

public class XdomMap extends Xdom {

	private Map<String, Xdom> value;

	public XdomMap() {
		super();
		this.value = new HashMap<String, Xdom>();
	}

	public XdomMap(Map<String, Xdom> value) {
		super();
		this.value = value;
	}

	public Map<String, Xdom> getValue() {
		return value;
	}

	public void setValue(Map<String, Xdom> value) {
		this.value = value;
	}

	public void put(String name, Xdom v) {
		this.value.put(name, v);
	}

	@Override
	public XdomType type() {
		return XdomType.MAP;
	}

	@Override
	public int size() {
		return value.size();
	}

	@Override
	public boolean has(String key) {
		return value.containsKey(key);
	}

	@Override
	public Xdom get(String fieldName) {
		return value.get(fieldName);
	}

	@Override
	public Iterator<String> mapNames() {
		return value.keySet().iterator();
	}
}
